﻿using System;
/*
    Using bitwise operators, write an expression for finding the value of the bit #3 of a given unsigned integer.
    The bits are counted from right to left, starting from bit #0.
    The result of the expression should be either 1 or 0.
 */
class BitwiseExtractBit
{
    static void Main()
    {
        Console.WriteLine("Enter a number: ");
        int num = int.Parse(Console.ReadLine());
        
        int p = 3;
        int mask = 1 << p;
        int nandMask = num & mask;
        int bit = nandMask >> p;

        Console.WriteLine("Third bit of a number is: " + bit);

    }
}
